<%= tr8n_with_options_tag(:default_locale => Tr8n::Config.default_admin_locale, :admin => true) do %>
	<%= render :partial => "/tr8n/common/header" %>
	
	<% unless @topics.empty? %>
	<div class="section_title">
	  <div class="tr8n_fltr" style="padding-top:6px; font-size:12px; color: #ccc;">
	    <%=image_tag('tr8n/plus.png')%> <%= link_to(tra("Start a new discussion topic"), :action => :topic, :mode => :create) %>
	  </div>
	  <div class="tr8n_txtl">
	  	<%=tra("{language} Language Discussion Topics", nil, :language => tr8n_current_language.native_name) %>  
		</div>
	</div>
	<div class="section">
	    <table style="width:100%;">
	       <tr style="border-bottom: 1px solid #ccc;">
	         <td class="tr8n_txtl" style="width:20%; padding:5px;"><%=tra("Author", "Forum column header")%></td>
	         <td class="tr8n_txtl" style="width:50%; padding:5px;"><%=tra("Topic", "Forum column header")%></td>
	         <td class="tr8n_txtl" style="width:10%; padding:5px;"><%=tra("Posts", "Forum column header")%></td>
	         <td class="tr8n_txtl" style="width:20%; padding:5px;"><%=tra("Last Post", "Forum column header")%></td>
	       </tr> 
	      <% @topics.each do |topic| %>
	        <%
	          style = (topic == @topics.last ? "" : "border-bottom:1px dotted #ccc;" )
	        %>  
	        <tr style="<%=style%>">
	          <td class="topic_value">
	            <table>
	              <tr>
	                <td style="vertical-align:top;padding:5px;">
	                  <%=tr8n_user_mugshot_tag(topic.translator, :linked => true)%>
	                </td>
	                <td style="vertical-align:top;padding:5px;">
	                  <%=tr8n_user_tag(topic.translator, :linked => true)%>
	                  <div style="color:grey;">
	                      <%=topic.created_at.trl(:date_time) %>
	                  </div>
	                  <div style="font-size:10px;padding-top:5px;">
	                    <% if tr8n_current_user_is_translator? and topic.translator == tr8n_current_translator %>  
                         <%= link_to(tra("Delete"), {:action => :delete_topic, :topic_id => topic.id}, {:confirm => trl("Are you sure you want to delete this topic and all of the messages under it?")})%>
	                    <% else %>
											   <%= link_to_function(tra("Report"), "Tr8n.UI.Lightbox.show('/tr8n/translator/lb_report?forum_topic_id=#{topic.id}', {width:600, height:360});") %>
	                    <% end %>
	                  </div>
	                </td>
	              </tr>
	            </table>
	          </td>
	          <td class="tr8n_txtl" style="padding:5px;">
	            <%=link_to(topic.topic, :action => :topic, :topic_id => topic.id)%><br>
	          </td>    
	          <td class="tr8n_txtl" style="padding:5px;">
	            <%=topic.post_count %>
	          </td>
	          <td class="topic_value" style="padding:5px;">
	            <% if topic.last_post %>
	               <div class="tr8n_txtl" style="font-size:10px;"><%=topic.last_post.created_at.trl(:date_time) %> 
								  <% if topic.translator and topic.translator.user %>
	                  <%=tra("by {user}", "Name of the publisher", :user => [topic.translator.user, tr8n_user_tag(topic.translator, :linked => true)])%>
									<% end %>
	               </div> 
	               <% 
	                  message = topic.last_post.message[0..60]
	                  message << "..." if topic.last_post.message.length > 60 
	               %> 
	               <div class="tr8n_txtl" style="font-style:italic; font-size:10px">"<%=link_to(h(message), :action => :topic, :topic_id =>topic.id, :last_page => true)%>"</div>
	            <% end %>
	            &nbsp;
	          </td>
	        </tr>
	      <% end %>
	    </table>
	  
			<%= tr8n_paginator_tag(@topics, :subject => 'forum topic') %>	
	</div>
	<% end %>
	
	<%= render :partial => "new_topic", :locals => {:include_cancel_button => false} %>
	<%= render :partial => "/tr8n/common/footer" %>
<% end %>